package utils;

import entity.Result;
import entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * author：wuBin
 * 类的描述：
 */
@ControllerAdvice
public class BaseExceptionController {

    @ResponseBody
    @ExceptionHandler(Exception.class) //声明捕捉的异常时Exception及其子类异常
    public Result GetException(Exception e){

        e.printStackTrace();
        return new Result(false, StatusCode.ERROR,e.getMessage());


    }
}
